# -*- coding: utf-8 -*-
"""
Tencent is pleased to support the open source community by making 蓝鲸智云(BlueKing) available.
Copyright (C) 2017 THL A29 Limited, a Tencent company. All rights reserved.
Licensed under the MIT License (the "License"); you may not use this file except in compliance with the License.
You may obtain a copy of the License at http://opensource.org/licenses/MIT
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and limitations under the License.
"""
from django.shortcuts import render,get_object_or_404
from django.http import HttpResponse
from .models import Question,Choice
def base(request):
    question_list = Question.objects.all()
    print question_list
    ctx = {"question_list" : question_list}
    return render(request,"leftwordsApp/base.html",ctx)

def detail(request,question_id):
    question = get_object_or_404(Question,pk=question_id)
    return render(request, "leftwordsApp/detail.html", {"question" : question})
def result(resquest,question_id):
    response = "你正在浏览问题 %s 的结果"
    return HttpResponse(response % question_id)

def vote(resquest,question_id):
    return HttpResponse("你正在为问题 %s 投票" % question_id)

